home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
130 MIDI Tool Box
/
130 MIDI Tool Box.iso
/
mpui04
/
mpuio4.bas
next >
Wrap
BASIC Source File
|
1988-08-12
|
2KB
|
141 lines
DECLARE SUB Send.Data (MidiOut$)
DECLARE SUB Read.Data (Byte%)
DECLARE SUB Send.Command (Cmd%)
' MPUIO2.BAS
'
' Routines pour IBM/MPU-401 avec Quick-Basic 4.00
' Routines for IBM/MPU-401 with Quick-Basic 4.00
'
' Michel Poirier
' MIDICOM, Montreal Fido 167/111
' (514) 744-7354 (data)
'
Initial:
CLS
KEY OFF
DEFINT A-Z
COLOR 7, 0
' MPU-401 ports & commands...
Dataport = 816
Comport = 817
DSR = 128
DRR = 64
Uart = 63
Ack = 254
Rst = 255
DIM DataByte AS STRING * 3
' These Dump Requests are for a TX81Z on Channel 4
SysSetUp$ = CHR$(&HF0) + CHR$(&H43) + CHR$(&H23) + CHR$(&H7E) + "LM 8976S0" + CHR$(&HF7)
VCED$ = CHR$(&HF0) + CHR$(&H43) + CHR$(&H23) + CHR$(&H3) + CHR$(&HF7)
ACED$ = CHR$(&HF0) + CHR$(&H43) + CHR$(&H23) + CHR$(&H7E) + "LM 8976AE" + CHR$(&HF7)
Start:
Send.Command Rst
Send.Command Uart
'Send.Data SysSetUp$
Send.Data VCED$
'Send.Data ACED$
PRINT "All numbers in Hexadecimal.": PRINT
PRINT "Header : ": PRINT
Read.Data Byte
PRINT HEX$(Byte), " System Exclusive"
Read.Data Byte
PRINT HEX$(Byte), " YAMAHA ID Number"
Read.Data Byte
PRINT HEX$(Byte), " Bulk Data on Channel"; Byte + 1
Read.Data Byte
PRINT HEX$(Byte), " Function Number"
Read.Data Byte
PRINT HEX$(Byte), " Data Size High"
Size = Byte * 256
Read.Data Byte
PRINT HEX$(Byte), " Data Size Low"
Size = Size + Byte
PRINT : PRINT "Data : ": PRINT
FOR c = 1 TO Size
Read.Data Byte
Total = Total + Byte
RSET DataByte$ = HEX$(Byte)
PRINT DataByte$;
NEXT c
PRINT : PRINT
Read.Data Byte
PRINT HEX$(Byte), "Checksum"
PRINT HEX$((NOT Total) + 1 AND 127), "Calculated Checksum"
PRINT
Read.Data Byte
PRINT HEX$(Byte), "End of Exclusive"
Finish:
Send.Command Rst
END
SUB Read.Data (Byte)
SHARED DRR, DSR, Comport, Dataport
WHILE (INP(Comport) AND DSR) = DSR: WEND
Byte = INP(Dataport)
END SUB
SUB Send.Command (Cmd%)
SHARED DRR, DSR, Comport, Dataport
WHILE (INP(Comport) AND DRR) = DRR
PURGE = INP(Dataport)
WEND
OUT Comport, Cmd
PURGE = INP(Dataport)
END SUB
SUB Send.Data (MidiOut$)
SHARED DRR, Comport, Dataport, Statport
FOR c = 1 TO LEN(MidiOut$)
WHILE (INP(Comport) AND DRR) = DRR
PURGE = INP(Dataport)
WEND
OUT Dataport, ASC(MID$(MidiOut$, c, 1))
PURGE = INP(Dataport)
NEXT c
END SUB